Converting Your AeroBasic Programs
Automation1 uses AeroScript, which is a new programming language for machine control. When you migrate your AeroBasic programs, this process tries to automatically convert them into AeroScript programs.
IMPORTANT: This process might not successfully convert some of your AeroBasic programs into Automation1 programs. If some of your AeroBasic programs cannot be converted, then you must manually rewrite them in AeroScript. See the Manual Conversion section on this page for more information.
To Convert Your AeroBasic Programs
- Navigate to the folder where you extracted the files from the
A3200ToAutomation1Migration.zip
file. - Make sure that folder has an AeroBasicToAeroScript folder.
- Copy these items into the AeroBasicToAeroScript folder:
- Your A3200 Active Parameter File
- All of your AeroBasic programs
- Make sure that the latest Microsoft Visual C++ Redistributable for Visual Studio 2019 is installed. This is installed with Automation1. If you do not have Automation1 installed, you can install the redistributable from the Microsoft support page, Microsoft Visual C++ Redistributable latest supported downloads.
- In the AeroBasicToAeroScript folder, open Windows Command Prompt or a PowerShell window.
- For each AeroBasic program that you convert, do the steps that follow:
- Make sure that your AeroBasic program uses UTF-8 encoding. Open your AeroBasic program in Notepad. Click File and select Save as... In the dialog that comes into view, click the Encoding drop-down and select UTF-8. If a dialog comes into view that asks if you want to replace the file, click Yes.
- In the command window that you opened, enter a command to convert your AeroBasic programs. See the syntax of this command in the examples that follow:
-
[AeroBasic Program]: This is the name of the A3200 AeroBasic program that you want to convert. This argument is required.
-
[A3200 parameter file]: This is the name of the active parameter file of your A3200 system. This argument is optional. If you do not supply a parameter file, the conversion tool will use default parameters and axis names.
-
[Ouput folder]: This is the path to an existing folder where the converted AeroScript program source files and generated log files will go. This argument is optional. If you do not supply an output folder, the files will go to the directory from which the conversion tool was executed.
- To execute the command, press the Enter key.
- In the folder that you specified for the
-o
argument or in the folder from which you executed this command if you did not use the-o
argument, make sure that you have the files that follow: - An AeroScript Program Source file with the same name as your AeroBasic program file. This has
.ascript
as the file extension. - A log file that includes all the errors and warnings that occurred during the conversion. This file has
.log
as the file extension. - Repeat steps A through D for each of the other AeroBasic programs that you want to convert.
Tip: If you cannot find the extracted files, you can download them again by clicking A3200ToAutomation1Migration.zip. Then extract them to a folder on your PC.
Command Prompt
AeroBasicToAeroScript.exe [AeroBasic program] -p [A3200 parameter file] -o [output directory]
PowerShell
.\AeroBasicToAeroScript.exe [AeroBasic program] -p [A3200 parameter file] -o [output directory]
The list that follows includes descriptions of the arguments you can pass to this command:
The examples that follow show this command converting an AeroBasic program:
Command Prompt
AeroBasicToAeroScript.exe "MyProgram.pgm" -p "MyParameters.prma" -o C:\ConvertedPrograms
PowerShell
.\AeroBasicToAeroScript.exe "MyProgram.pgm" -p "MyParameters.prma" -o C:\ConvertedPrograms
If the conversion tool cannot create working AeroScript code from your AeroBasic programs, the tool marks program lines that could not be converted with the preprocessor statement #error_unconvertible
. See the Manual Conversion section that follows for details on how to manually correct these lines.
Manual Conversion
If you must manually rewrite some of your AeroBasic programs in AeroScript, use the powerful programming and development tools that are available in the Develop workspace of Automation1 Studio. For information about the Develop workspace, see the
Lines of code that could not be converted to AeroScript are marked with the #error_unconvertible
preprocessor statement. These statements cause a compile-time error on each line that they occur. This lets you quickly find the unconverted code in the Build tab of the Develop workspace.
The list that follows includes reasons that the conversion tool could not convert a line of AeroBasic to AeroScript. Refer to the AeroScript Equivalents of AeroBasic Commands for the A3200 page to see if the AeroBasic command has an AeroScript equivalent.
- Some AeroBasic commands do not have AeroScript equivalents and were removed in Automation1.
- Some commands have an AeroScript equivalent, but they were added in a recent version of Automation1 and are not yet recognized by the automatic conversion tool.
- The automatic conversion tool cannot expand preprocessor defines or macros. If a preprocessor define or macro uses an AeroBasic command that cannot be converted, the
#define
or#macro
statement is marked as unconvertible as well as all instances of the defined target word. - If a preprocessor define or macro is ambiguous and must have context to convert, the
#define
or#macro
statement is marked as unconvertible as well as all instances of the defined target word. This can occur if an AeroBasic command was replaced by more than one AeroScript function. See the section that follows for information about ambiguous definitions.
Using AeroScript Properties for Ambiguous Definitions
Sometimes you can use AeroScript Properties instead of selecting from two or more AeroScript functions. You can use property accessors to call different AeroScript functions based on if the property is being read or written to.
For example, a define that expands to the AeroBasic command $DO
is ambiguous and must have context to convert because $DO
was replaced with two functions in AeroScript, DigitalOutputGet()
and DigitalOutputSet()
. The program example that follows shows how to create a property to convert the AeroBasic command $DO
instead of having to select either DigitalOutputGet()
and DigitalOutputSet()
.This lets you keep the unexpanded definition in your program, and you only have to manually convert the definition.
Program Example
property $do[$index as integer][$axis as axis] as integer get return DigitalOutputGet($axis, $index) end set DigitalOutputSet($axis, $index, value) end end // Now change any definitions to use indexes instead of dot-notation, // as the AeroBasic dot-notation (as in $do[1].X) is not valid in // AeroScript. Finally, delete the #error_unconvertible marker from // the definition and all use-sites. #error_unconvertible #define MyDO $do[1][X]
Next Step: Reconfiguring Program Automation